
cc.Class({
    extends: cc.Component,

    properties: {
        className:"bglayer",
        hand:{
            default:null,
            type:cc.Component,
        },
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad: function () {
        this.node.thisJS = this;
        this.timer =  cc.find("timer",this.node);
        this.timer_label =  cc.find("timer_label",this.timer);
        this.initUI();
    },
    start: function () {
       
    },
    initUI: function(){
        EventManager.addEventObeserveF(EventConfig.startGame, handler(this,
            this.gameStart),"bglayer");
        EventManager.addEventObeserveF(EventConfig.UserEnterDeskNtf, handler(this,
            this.userJoin),"bglayer");
        
    },
     //玩家进入桌子,更新个人信息  
    gameStart:function(info){
        if(info.current_play_count != null){
            this.hand.getComponent(cc.Label).string  =(info.current_play_count+1)+ "/" +info.total_play_count+"局";
        }
    },
    userJoin:function(info){
        if(info.current_play_count != null){
            this.hand.getComponent(cc.Label).string  =(info.current_play_count+1)+ "/" +info.total_play_count+"局";
        }
    },
});